package com.eqdd.yiqidian.db.dao;

import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;

import com.eqdd.yiqidian.bean.User;

import java.util.List;

/**
 * @author吕志豪 .
 * @date 17-11-28  下午4:11.
 * Github :https://github.com/lvzhihao100
 * E-Mail：1030753080@qq.com
 * 简书 :http://www.jianshu.com/u/6e525b929aac
 */
@Dao
public interface UserDao {
    @Query("select * FROM user")
    LiveData<List<User>> getAllUser();

    @Query("select * FROM user where uname =:name")
    LiveData<User> getUserByName(String name);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insertUser(User user);

}
